package net.jumpengine.bean;

import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import net.jumpengine.Manager;
import net.jumpengine.enume.MouseState;
import net.jumpengine.inter.IControl;
import net.jumpengine.inter.IControlEvent;
import net.jumpengine.inter.IInputEvent;
import net.jumpengine.inter.IMouseEvent;
import net.jumpengine.po.Border;

/**
 * 控件基础类,实现了控件编辑本属性
 * <br /><br />
 * <b>作者:&nbsp;</b>张天文 <br />
 * <b>日期:&nbsp;</b>2020年2月26日 下午5:08:17<br />
 * @date
 */
public abstract class Control extends ClickBase implements IControl,IControlEvent {
	protected Border border;
	protected boolean able=true;
	protected MouseState mouseState=MouseState.mouseOut;
	protected Color color=Manager.getBackColor();
	protected Color backColor=Manager.getColor();
	protected Font font=Manager.getFont();
	protected String text;
	protected boolean change=true;
	protected boolean focus;
	
	/**
	 * 简单构造方法
	 * @param x x坐标
	 * @param y y坐标
	 * @param width 宽度
	 * @param height 高度
	 * @param border 边框信息
	 */
	public Control(int x, int y, int width, int height,Border border) {
		this(x, y, width, height, 0, border);
	}
	
	/**
	 * 有层级的构造方法
	 * @param x x坐标
	 * @param y y坐标
	 * @param width 宽度
	 * @param height 高度
	 * @param index 层级
	 * @param border 边框信息
	 */
	public Control(int x, int y, int width, int height, int index,Border border) {
		super(x, y, width, height,index);
		this.border=border;
	}
	
	public Color getColor() {
		return color;
	}

	public void setColor(Color color) {
		this.color = color;
	}
	public Color getBackColor() {
		return backColor;
	}

	public void setBackColor(Color backColor) {
		this.backColor = backColor;
	}

	@Override
	public void setVisible(boolean visible) {
		this.visible=visible;
		able=visible;
	}

	@Override
	public void setAble(boolean able) {
		this.able=able;
	}

	@Override
	public boolean isAble() {
		return able;
	}

	@Override
	public Border getBorder() {
		return border;
	}
	
	public Font getFont() {
		return font;
	}

	public void setFont(Font font) {
		this.font = font;
	}
	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public boolean isChange() {
		return change;
	}

	public void setChange(boolean change) {
		this.change = change;
	}
	
	@Override
	public void setMouseState(MouseState state) {
		this.mouseState=state;
	}

	public boolean isFocus() {
		return focus;
	}

	public void setFocus(boolean focus) {
		this.focus = focus;
	}
	@Override
	public IInputEvent getInputEvent() {
		return null;
	}
	@Override
	public IMouseEvent getMouseEvent() {
		return null;
	}
}
